package com.gmadmin.sysadmin.security.init;

import com.gmadmin.sysadmin.security.service.OnlinePermsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @Author michael.yang
 * @CreateDate 2020/4/13
 * @Describe spring boot启动完成后，执行这个类，启动netty服务
 */
@Component
@Slf4j
@Order(1)
public class ApplicationRunnerImpl implements ApplicationRunner {

    @Autowired
    private OnlinePermsService onlinePermsService;

    @Override
    public void run(ApplicationArguments args){
        try {
            log.info("spring boot启动完成，初始化缓存信息。");
            onlinePermsService.init();
        } catch (Exception e) {
            log.error("初始化缓存信息异常:", e);
        }
    }



}
